Add gdk_window_mark_paint_from_clip and call from widget drawing
authorAlexander Larsson <alexl@redhat.com>
Thu, 9 Oct 2014 08:18:02 +0000 (10:18 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 13 Oct 2014 14:43:31 +0000 (10:43 -0400)
This is a new function that gets called every time we're drawing
some area in the Gtk paint machinery. It is a no-op right now, but
it will be required later to keep track of what areas which
we previously rendered with GL was overwritten with cairo contents.

docs/reference/gdk/gdk3-sections.txt
gdk/gdkwindow.c
gdk/gdkwindow.h
gtk/gtkwidget.c

index 59d4b334ab331d94903b01dd3e21022d1f892cf5..fd281cf0202b3fb78b0d257a36b0b1c7c24bd0ea 100644 (file)
@@ -394,6 +394,7 @@ gdk_window_constrain_size
 gdk_window_beep
 gdk_window_get_scale_factor
 gdk_window_set_opaque_region
+gdk_window_mark_paint_from_clip
 
 <SUBSECTION>
 gdk_window_get_clip_region
index f5c06100bbabc3f66ec35aa551e1d4cf7e6b867f..71400708c04292f60edc535d54bbe2e109a1357f 100644 (file)
@@ -2813,6 +2813,26 @@ gdk_window_begin_paint_region (GdkWindow       *window,
     gdk_window_clear_backing_region (window);
 }
 
+/**
+ * gdk_window_mark_paint_from_clip:
+ * @window: a #GdkWindow
+ * @cr: a #cairo_t
+ *
+ * If you call this during a paint (e.g. between gdk_window_begin_paint_region()
+ * and gdk_window_end_paint() then gdk will mark the current clip region of the
+ * window as being drawn. This is required when mixing GL rendering via
+ * gdk_cairo_draw_from_gl() and cairo rendering, as otherwise gdk has no way
+ * of knowing when something paints over the gl drawn regions.
+ *
+ * This is typically called automatically by Gtk and you don't need
+ * to care about this.
+ **/
+void
+gdk_window_mark_paint_from_clip (GdkWindow          *window,
+                                cairo_t            *cr)
+{
+}
+
 /**
  * gdk_window_end_paint:
  * @window: a #GdkWindow
index 38a67b5afc60fe187cfd6abfc27fd48a296fa2a2..55c5898dc8a5b3c40c3c872043a7fc1d9dbbd2cd 100644 (file)
@@ -739,6 +739,9 @@ cairo_region_t *gdk_window_get_visible_region(GdkWindow         *window);
 GDK_AVAILABLE_IN_ALL
 void         gdk_window_begin_paint_rect   (GdkWindow          *window,
                                             const GdkRectangle *rectangle);
+GDK_AVAILABLE_IN_3_14
+void         gdk_window_mark_paint_from_clip (GdkWindow          *window,
+                                              cairo_t            *cr);
 GDK_AVAILABLE_IN_ALL
 void         gdk_window_begin_paint_region (GdkWindow          *window,
                                             const cairo_region_t    *region);
index b2d3424910258b5f58e4aef201811016762616be..000851928221f0e4de045600103f1c9aba948a6e 100644 (file)
@@ -6948,6 +6948,8 @@ _gtk_widget_draw_internal (GtkWidget *widget,
     {
       gboolean result;
 
+      gdk_window_mark_paint_from_clip (window, cr);
+
       g_signal_emit (widget, widget_signals[DRAW],
                      0, cr,
                      &result);